--- a/libfs/devices.c
+++ b/libfs/devices.c
@@ -38,6 +38,7 @@
 #endif
 
 #include <sys/types.h>
+#include <sys/sysmacros.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #if defined(__DragonFly__)
